package com.wkbb.common.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.wkbb.common.handler.JsonUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@ApiModel("标签表")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Tag implements Serializable {

    @ApiModelProperty("ID")
    private Integer id;
    @ApiModelProperty("唯一标识")
    private Integer parentId;
    @ApiModelProperty("所属分类")
    private String classificationName;
    @ApiModelProperty("名称")
    private String name;
    @ApiModelProperty("标签等级：1分类 2子类")
    private Integer level;
    @ApiModelProperty("标签类型：1课程 2托管 3场地")
    private Integer type;
    @ApiModelProperty("子类列表")
    private List<Tag> childLabelList;
    @ApiModelProperty("排序标识")
    private Integer rank;
    @ApiModelProperty("状态 1启用 0禁用")
    private Boolean enabled;
    @ApiModelProperty("创建时间")
    private Date createTime;
    @ApiModelProperty("发布者")
    private Long userId;
    @ApiModelProperty("发布者名称")
    private String username;

    public static void main(String[] args) {
        Tag tag = new Tag();
        tag.setName("语言能力");
        tag.setLevel(1);
        tag.setParentId(1);
        tag.setType(1);
        tag.setRank(1);
        tag.setEnabled(true);
        System.out.println(JsonUtil.objectToJson(tag));
    }

    public String getTypeName() {
        if (type == null) return null;
        switch (type){
            case 1 : return "课程";
            case 2 : return "托管";
            case 3 : return "场地";
        }
        return "";
    }
}
